<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of UserDaoImpl
 *
 * @author Administrator
 */
namespace frontend\dao\impl;
use frontend\bean\User;
use frontend\dao\UserDao;
use Yii;
class UserDaoImpl implements UserDao{
    
    /*
     * @param number $mobile
     */
    public function getUserByMobile($mobile) {
        $connection = Yii::$app->db;
        $sql = "SELECT * FROM `user` WHERE mobile=:mobile ";
        $command = $connection->createCommand($sql);
         $command->bindValue(':mobile', $mobile);
        $result = $command->queryOne();
      
        return $result?(new User())->load($result):null;
        
    }
    
      /*
     * @param number $mobile
     */
    public function getUserByUid($uid) {
        $connection = Yii::$app->db;
        $sql = "SELECT * FROM `user` WHERE uid=:uid ";
        $command = $connection->createCommand($sql);
         $command->bindValue(':uid', $uid);
        $result = $command->queryOne();
      
        return $result?(new User())->load($result):null;
        
    }
    
    
    /*
     * @param string $username
     */
    public function getUserByName($username) {
        
    }

    

//put your code here
}
